#include<bits/stdc++.h>
#define R register int 
using namespace std; 
const int N=8008;
struct abc{
	int sum,wei;
}a[N],s[N];
int n,Q,x,y,z;
inline int read(){
	int ss=0;
	char sp=getchar();
	while(sp>'9' || sp<'0') sp=getchar();
	while(sp>='0' && sp<='9') ss=(ss<<3)+(ss<<1)+sp-48,sp=getchar();
	return ss;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d",&n),Q=read();
	for(R i=1; i<=n; ++i){
		a[i].sum=read();
		s[i].sum=a[i].sum;
		s[i].wei=i;
	}
	for(R i=1; i<=n; ++i){
		for(R j=i; j>=2; --j) if(s[j].sum<s[j-1].sum) swap(s[j],s[j-1]); 
	}
	for(R i=1; i<=n; ++i) a[s[i].wei].wei=i;
	while(Q--){
		scanf("%d",&x);
		if(x==1){
			scanf("%d %d",&x,&y);
			if(s[a[x].wei].sum>y){
				s[a[x].wei].sum=y;
				for(R i=a[x].wei; i>=2; --i){
					if(s[i].sum<s[i-1].sum || (s[i].sum==s[i-1].sum && s[i].wei<s[i-1].wei)){
						swap(s[i],s[i-1]);
						a[s[i].wei].wei=i;
						a[s[i-1].wei].wei=i-1;
					}
					else break;
				} 
			}
			if(s[a[x].wei].sum<y){
				s[a[x].wei].sum=y;
				for(R i=a[x].wei; i<n; ++i){
					if(s[i+1].sum<s[i].sum || (s[i+1].sum==s[i].sum && s[i].wei>s[i+1].wei)){
						swap(s[i+1],s[i]);
						a[s[i].wei].wei=i;
						a[s[i+1].wei].wei=i+1;
					}
					else break;
				}
			}
		}
		else{
			scanf("%d",&x);
			printf("%d\n",a[x].wei);
		}
	} 
	return 0;
} 
